﻿
Imports System.Object
Imports VSModel
Imports Cls_Common
Imports System.IO
Partial Class FrontEnd_Control_Users_InfoShop
    Inherits System.Web.UI.UserControl
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            ShowData()
        End If
    End Sub

    Private Sub ShowData()
        Using Data As New VSEntities
            Dim intUserId As Integer = 0
            Dim intProductId As Integer
            If Not Page.RouteData.Values("ProductId") Is Nothing Then
                intProductId = Page.RouteData.Values("ProductId")
                'Add DomainName DUC 09-09-2014
                Dim l = (From t In Data.Products Where t.Domain = DomainName And t.ProductId = intProductId).FirstOrDefault
                If Not l Is Nothing Then
                    intUserId = l.CreatorId
                    hplYahoo.Text = IIf(IsNothing(l.Store.YahooId), "", "ymsgr:" & l.Store.YahooId)

                End If
            End If
            'Add DomainName DUC 09-09-2014
            Dim p As User = (From q In Data.Users Where q.Domain = DomainName And q.UserId = intUserId Select q).FirstOrDefault
            Dim h = (From k In Data.Stores Where k.Domain = DomainName And k.UserId = intUserId Select k).FirstOrDefault

            If Not p Is Nothing Then
                If Not h Is Nothing Then
                    hplTitle.Text = IIf(IsNothing(h.Title), "", h.Title)
                End If
                ltrCreated.Text = DateToString(p.Created, "mm/dd/yyyy")
                ltrAddress.Text = IIf(IsNothing(p.DiaChi), "", p.DiaChi)
                ltrPhone.Text = IIf(IsNothing(p.Phone), "", p.Phone)
                hplEmail.Text = IIf(IsNothing(p.Email), "", p.Email)
                hplEmail.NavigateUrl = "mailto:" & IIf(IsNothing(p.Email), "", p.Email)
                hplSendMail.NavigateUrl = "mailto:" & IIf(IsNothing(p.Email), "", p.Email)

                hplMore.NavigateUrl = ""
            End If
        End Using
    End Sub
End Class
